package org.example.reemploymentsys.repository;


import org.example.reemploymentsys.entity.Exam;
import org.example.reemploymentsys.entity.Organization;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ExamRe extends JpaRepository<Exam,Long>, JpaSpecificationExecutor<Exam> {
    @Query("select e from Exam e where e.trainingPlan.id= ?1")
    List<Exam> findByTrainPlanId(Long id);
    @Query("select e from Exam e where e.organization.id= ?1")
    List<Exam> findByOrganizationId(String organizationId);
    List<Exam> findByOrganizationAndName(Organization organization, String name);
    Exam findByName(String name);
}
